package com.tc.constant;

import org.apache.commons.lang3.function.FailableIntBinaryOperator;

public class RedisConstants {

    /**
     * 验证发 KEY 前缀
     */
    private static  final String VERIFICATION_CODE_KEY_PREFIX = "verification_code:";

    /**
     * 全局 虎扑用户ID生成器
     */
    public static final String GLOBAL_HUPU_ID_GENERATOR_KEY = "hupu.id.generator";

    /**
     * 用户角色 Key
     *
     */
    public static final  String  USER_ROLES_KEY_PREFIX = "user:roles:";
    /**
     * 角色 权限 key
     */
    public static final String ROLE_PERMISSION_KEY_PREFIX = "role:permissions:";
    /**
     * 构建验证码
     */
    public static String buildVerification(String phone){
        return VERIFICATION_CODE_KEY_PREFIX + phone;
    }

    /**
     * 构建全局虎扑用户ID生成器的KEy
     * @return
     */
    public static String buildHUPUIdGenerator(){
        return GLOBAL_HUPU_ID_GENERATOR_KEY;
    }

    /**
     * 构建用户角色 key
     *
     */
    public static String buildUserRoleKey(Long userId){
        return USER_ROLES_KEY_PREFIX + userId;
    }

    public static String buildRolePermissionsKey(String roleKey){
        return ROLE_PERMISSION_KEY_PREFIX + roleKey;
    }
}
